<template>
	<view class="wraptop" style="min-height: 100vh;">

		<view class="content_input">
			<!-- <input type="text" value="" v-model="name" class="input_cot" style="text-align: left;border-radius: 40px;background-color: rgb(250,250,250);"
			 :placeholder="groupname" /> -->	 
			<textarea value="" v-model="name" maxlength="500" :placeholder="groupname" style="width: 75%; height: 180px;border: 1px solid #606660;border-radius: 10px; padding: 15px; margin-bottom: 30px;"/>
		</view>
		<view class="btn" @click="regup">
			<text>完成</text>
		</view>
		<!-- 		<view class="bottom_cont">
			<text>《使用条款和隐私政策》</text>
			<text @click="gologin">已经有账户了！ 登陆</text>
		</view> -->
	</view>
</template>

<script>
	var WebIM = require("../../utils/WebIM")["default"];
	export default {
		data() {
			return {
				name:'',
				roomid:'',
				q_id:'',
				groupname:''
			}
		},
		onLoad: function(options) {
			this.roomid = options.roomId
			this.q_id = options.q_id
			this.groupname = options.groupname
			let option = {
				groupId: this.roomid		//群组id
			};
			WebIM.conn.getGroupInfo(option).then((res) => {
				this.name=res.data[0].description
			})
		},
		methods: {
			regup() {
				// 修改群信息
				let option = {
				    groupId: this.roomid,
				    groupName: this.groupname, // 群组名称
				    description: this.name     // 群组简介
				};
				WebIM.conn.modifyGroup(option).then((res) => {
				    console.log(res)
				})
				let token = uni.getStorageSync("token")
				uni.request({
					url: this.G_base + '/api/lz/qupdate',
					data: {
						q_title: this.name,
						id:this.q_id
					},
					method: "POST",
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation': 'Bearer ' + token
					},
					success: (res) => {
						console.log(res);
						if(res.data.status==200){
							uni.showToast({
								title:"修改成功"
							})
							setTimeout(()=>{
								uni.navigateBack({
									delta:1
								})
							},1000)
						}
						


					},
					fail: (err) => {
						console.log(err)
					}
				});
			},
		}
	}
</script>

<style>
	.bottom_cont text:nth-child(1) {
		margin-bottom: 7px;
	}

	.bottom_cont text {

		top: 660px;
		width: 154px;
		color: rgba(16, 16, 16, 1);
		font-size: 14px;
		font-family: PingFangSC-regular;
		display: flex;
		justify-content: center;
		align-items: center;
		margin-left: 50%;
		transform: translateX(-50%);
	}

	.wraptop {
		background-color: rgb(255, 255, 255);
		padding-bottom: 30%;
	}

	.content_input {
		display: flex;
		justify-content: center;
		align-items: center;
		flex-wrap: wrap;
		margin-top: 50px;
	}

	.input_cot {
		padding-left: 12px;
		width: 300px;
		height: 54px;
		line-height: 54px;
		border-radius: 20px;
		text-align: center;
		margin-bottom: 22px;
		color: rgba(16, 16, 16, 1);
		font-size: 14px;
		font-family: PingFangSC-regular;
	}

	.bottom_cont {
		margin-top: 32px;
	}

	.btn {

		background: -webkit-linear-gradient(left, #a00000, #e10004, #a00000);
		left: 107px;
		top: 578px;
		width: 200px;
		height: 50px;
		line-height: 20px;
		border-radius: 40px;
		text-align: center;
		display: flex;
		justify-content: center;
		align-items: center;
		margin-left: 50%;
		transform: translateX(-50%);

	}

	.btn text {
		color: #FFFFFF;
		left: 189px;
		top: 593px;
		width: 40px;
		height: 20px;
		font-size: 20px;
		text-align: center;
		font-family: PingFangSC-regular;
	}
</style>
